
public class TimeTranslation {
	public float playbackDiff;

	public void run() {

			
		float lastDiff = Main.quarter;

			float time=0;
			float bestFit=100;
			float bestFitRatio=1;
			float ratio=playbackDiff/lastDiff;
			for(int i=0;i<CONSTANTS.ratioArray.length;i++){
				for(int j=0;j<CONSTANTS.ratioArray.length;j++){

					if (Math.abs(ratio-CONSTANTS.ratioArray[i]/CONSTANTS.ratioArray[j])<bestFit){
						bestFitRatio=CONSTANTS.ratioArray[i]/CONSTANTS.ratioArray[j];
						bestFit=Math.abs(ratio-CONSTANTS.ratioArray[i]/CONSTANTS.ratioArray[j]);
	
					}
				}
			}
			
			time = lastDiff*bestFitRatio;
			
			
//				while(time>2000){
//					time=time/2;
//				}
//				System.out.println("playback Diff: "+playbackDiff);
//				System.out.println("wait time: "+time);
//		float time=(float) (playbackDiff/1.2);
		if (time<2000){
			Main.improvise.waitTime = (int) time;
		}
		else {
			if (playbackDiff<2000){
				Main.improvise.waitTime = (int) playbackDiff;
			}
			else
			{
				Main.improvise.waitTime=500;
			}
		}
	}
}
